import path from 'path'
import { BuildOptions } from 'vite'

const isProd = process.env.NODE_ENV === 'production'

const buildOptions: BuildOptions = {
  cssCodeSplit: true,
  sourcemap: isProd ? false : 'inline',
  minify: 'terser',
  outDir: path.resolve(__dirname, '../docker-config/dist'),
  emptyOutDir: true,
  terserOptions: {
    compress: {
      keep_infinity: true,
      drop_console: true, //打包时删除console
      drop_debugger: true //打包时删除 debugger
    }
  },
  rollupOptions: {
    external: [],
    output: {}
  }
}

export default buildOptions
